---
title: RangeCalendar
description: A RangeCalendar displays a calendar interface that allows users to select a range of dates.
featured: true
component: true
links:
  doc: https://react-spectrum.adobe.com/react-aria/RangeCalendar.html
---

There is no standalone range calendar element in HTML. Two separate `<input type="date">` elements could be used, but this is very limited in functionality, lacking in internationalization capabilities, inconsistent between browsers, and difficult to style. RangeCalendar helps achieve accessible and international range calendar components that can be styled as needed.

<ComponentPreview name="range-calendar-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
  <TabsTrigger value="cli">CLI</TabsTrigger>
  <TabsTrigger value="manual">Copy & Paste</TabsTrigger>
</TabsList>

<TabsContent value="cli">

<PackageManagerTabs>
  <PackageManagerContent value="npm">
    ```bash
    npx shadcn@latest add https://jollyui.dev/[[STYLE]]/calendar
    ```
  </PackageManagerContent>
  <PackageManagerContent value="pnpm">
    ```bash
    pnpm dlx shadcn@latest add https://jollyui.dev/[[STYLE]]/calendar
    ```

  </PackageManagerContent>
  <PackageManagerContent value="bun">
    ```bash
    bunx --bun shadcn@latest add https://jollyui.dev/[[STYLE]]/calendar
    ```
  </PackageManagerContent>
  <PackageManagerContent value="yarn">
    ```bash 
    npx shadcn@latest add https://jollyui.dev/[[STYLE]]/calendar
    ```
  </PackageManagerContent>
</PackageManagerTabs>

</TabsContent>

<TabsContent value="manual">

<Steps>

<Step>Install the following dependencies: `@internationalized/date`</Step>

<Step>
  This components uses the following components, which you also need to install:
  - [Button](../../../docs/components/button)
</Step>

<Step>Copy and paste the following code into your project: calendar.tsx</Step>

<ComponentSource name="calendar" />

<Step>Update the import paths to match your project setup.</Step>

</Steps>

</TabsContent>

</Tabs>

## Composed Components

A RangeCalendar uses the following components, which may also be used standalone or reused in other components.

<ComponentCards>
  <ComponentCard component="button" />
</ComponentCards>

## Reusable Wrapper - Example

If you will use a RangeCalendar in multiple places in your app, you can wrap all of the pieces into a reusable component. This way, the DOM structure, styling code, and other logic are defined in a single place and reused everywhere to ensure consistency.

The installed file includes a reusable wrapper `JollyRangeCalendar`. This wrapper serves as an excellent starting point for use throughout your codebase.

<ComponentPreview name="rangecalendar-reusable" />

The `JollyRangeCalendar` component extends the props of React Aria RangeCalendar and adds:

| Prop           | Type                  | Default     | Description              |
| -------------- | --------------------- | ----------- | ------------------------ |
| `errorMessage` | `string \| undefined` | `undefined` | Error message to display |

You can copy this wrapper and create variations as needed for different use cases in your application. This approach promotes consistency while still allowing for flexibility in implementation.

## Examples

### Basic

<ComponentPreview name="range-calendar-demo" />

### Multi-Month

<ComponentPreview name="range-calendar-multi-month" />

### Validation

<ComponentPreview name="range-calendar-validation" />

#### Unavailable Dates

<ComponentPreview name="range-calendar-unavailable" />

#### Non-Continuous Ranges

<ComponentPreview name="range-calendar-non-continuous" />

#### Error Message

<ComponentPreview name="range-calendar-error" />

### Disabled

<ComponentPreview name="range-calendar-disabled" />

#### Read-only

<ComponentPreview name="range-calendar-readonly" />
